home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / ASTRNOMY / AA_51.ZIP / DIURPX.C < prev    next >
C/C++ Source or Header  |  1993-02-09  |  1KB  |  63 lines

  1. /* Diurnal parallax, AA page D3
  2.  */
  3.  
  4.  
  5. #include "kep.h"
  6. #define DISFAC 2.3454780e4
  7.  
  8. /* distance to center of Earth, in Earth radii */
  9. extern double trho;
  10.  
  11. /* observer's geocentric latitude, degrees */
  12. extern double tlat;
  13.  
  14.  
  15. int diurpx( last, ra, dec, dist )
  16. double last;  /* local apparent sidereal time, radians */
  17. double *ra;  /* right ascension, radians */
  18. double *dec; /* declination, radians */
  19. double dist; /* Earth - object distance, au */
  20. {
  21. double cosdec, sindec, coslat, sinlat;
  22. double p[3], dp[3], x, y, z, D;
  23.  
  24. /* Don't bother with this unless the equatorial horizontal parallax
  25.  * is at least 0.005"
  26.  */
  27. if( dist > 1758.8 )
  28.     return(-1);
  29.  
  30. cosdec = cos(*dec);
  31. sindec = sin(*dec);
  32.  
  33. /* Observer's astronomical latitude
  34.  */
  35. x = tlat * DTR;
  36. coslat = cos(x);
  37. sinlat = sin(x);
  38.  
  39. /* Convert to equatorial rectangular coordinates
  40.  * unit distance = earth radius
  41.  */
  42. D = dist * DISFAC;
  43. p[0] = D*cosdec*cos(*ra);
  44. p[1] = D*cosdec*sin(*ra);
  45. p[2] = D*sindec;
  46.  
  47. dp[0] = -trho*coslat*cos(last);
  48. dp[1] = -trho*coslat*sin(last);
  49. dp[2] = -trho*sinlat;
  50.  
  51. x = p[0] + dp[0];
  52. y = p[1] + dp[1];
  53. z = p[2] + dp[2];
  54. D = x*x + y*y + z*z;
  55. D = sqrt(D);    /* topocentric distance */
  56.  
  57. /* recompute ra and dec */
  58. *ra = zatan2(x,y);
  59. *dec = asin(z/D);
  60. showcor( "diurnal parallax", p, dp );
  61. return(0);
  62. }
  63.